package club.itstudio.IContainer.controller.teacher;

import club.itstudio.IContainer.annotation.LoginRequired;
import club.itstudio.IContainer.annotation.TeacherRequired;
import club.itstudio.IContainer.entity.WebMenu;
import club.itstudio.IContainer.util.Result;
import club.itstudio.IContainer.util.ResultUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @ClassName TeacherWebMenuController
 * @Author alex
 * Date 2021/4/27 1:45 下午
 * Version 1.0
 **/
@RestController
@RequestMapping("/teacher/menu")
public class TeacherWebMenuController {

    private static List<WebMenu> mainMenu;

    static {
        // 主页
//        WebMenu homeMenu = new WebMenu("main", "主页", "layui-icon-home", "/", null);
        // 课程管理
        WebMenu courseMenu = new WebMenu("courseMenu", "课程管理", "layui-icon-user", "/menu/course/courseList", null);

        // 学生申请
        WebMenu studentApplicationMenu = new WebMenu("studentApplicationMenu", "学生申请", "layui-icon-list", "/menu/application/applicationList", null);

        // 镜像管理
        WebMenu imageMenu = new WebMenu("imageMenu", "镜像管理", "layui-icon-template-1", "/menu/image/imageList", null);

        // 总菜单
        mainMenu = new ArrayList<>(Arrays.asList(courseMenu, studentApplicationMenu, imageMenu));
    }

    @LoginRequired
    @TeacherRequired
    @GetMapping
    public Result getTeacherWebMenu() {
        return ResultUtil.success(mainMenu);
    }
}
